<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button class="but1">我爱你清楚</button>
    <button class="but2">我爱你添加</button>
    <script>
      

        var but1=document.querySelector(".but1");
        var but2=document.querySelector(".but2");
        var time =setInterval(() => {
            console.log("I LOVE YOU");
        }, 2000);
        but1.onclick=function(){
            clearInterval(time)
        }

        but2.onclick=function(){
            time =setInterval(() => {
                console.log("I LOVE YOU");
            }, 2000);
        }


        
    </script>
</body>
</html>